<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <clear-name>
        </clear-name>

    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.13/dist/vue.js"></script>
    <script>
        const Child = {
            template: `
            <div>
                <slot name='b'></slot>
                <h2>我是Child子组件内容</h2>
                 <slot name='a'></slot>
                 <slot :arr='arr' :msg='msg'></slot>
            </div>
            `,
            data(){
                return{
                    arr:[2,3,4,5,6],
                    msg:'我是'
                }
            }
        }
        const Child1 = {

            template: `
            <div>
               <h2>我是Child1子组件内容</h2> 
              
            </div>
            `

        }

        const ClearName = {
            template: `
            <div>
            <h1>我是父组件</h1>

            <hr>
            <child >
            <div slot-scope='name'>
                {{ name.arr }}
                <ul>
                    <li v-for='item in name.arr'>
                        {{ item }}
                    </li>
                </ul>   
                <p>{{ name.msg}}</p> 
            </div> 
            
            <div slot='a'>
                <button> 
                    我是一个按钮
                </button>
                <p>
                    我是一个p标签
                </p>
            </div> 
            <div slot='b'>
                <button> 
                    我不是一个按钮
                </button>
                <p>
                    我不是一个p标签
                </p>
            </div> 
            </child>
            <hr>
            <child1 ref="child1">
            </child1>
            </div>
            `,
            components: {
                Child: Child,
                Child1: Child1
            },
            mounted(){
               
            }
        }

        Vue.component('ClearName', ClearName)
        var vm = new Vue({
            el: '#app'
        })


    </script>


</body>

</html>